/**
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company: gzhc365 </p>
 */
package cn.midi365.wedding;

import io.github.biezhi.wechat.WeChatBot;
import io.github.biezhi.wechat.api.annotation.Bind;
import io.github.biezhi.wechat.api.constant.Config;
import io.github.biezhi.wechat.api.enums.MsgType;
import io.github.biezhi.wechat.api.model.WeChatMessage;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSONObject;

/**
 * Description: TODO {一句话描述类是干什么的}<br/>
 *
 * @author zihong
 * @date: 2018年4月20日 下午1:19:48
 * @version 1.0
 * @since JDK 1.7
 */
public class HelloBot extends WeChatBot {

    Logger log = LoggerFactory.getLogger(HelloBot.class);

    /**
     * TODO(这里用一句话描述这个方法的作用). <br/>
     * 
     * @author zihong
     * @date: 2018年4月20日 下午1:19:48
     * @version 1.0
     *
     * @param args
     */

    public HelloBot(Config config) {
        super(config);
    }

    @Bind(msgType = MsgType.TEXT)
    public void handleText(WeChatMessage message) {
        // if (StringUtils.isNotEmpty(message.getName())) {
        log.info("接收到 [{}] 的消息: {}", JSONObject.toJSONString(message));
//        this.sendMsg(message.getFromUserName(), "自动回复: " + message.getText());
        // }
    }

    public static void main(String[] args) {
        HelloBot bot = new HelloBot(Config.me().assetsDir("D:\\rapid").autoLogin(true).showTerminal(true));
        bot.start();
        boolean sendMsg = bot.sendMsgByName("少年游", "胡东");
        
        System.err.println("+++++++++++++++++++++++++++++"+sendMsg);
    }

}
